package 数组.easy;

import java.util.Arrays;

/**
 * @author Lw中
 * @date 2020/8/15 8:50
 */
public class WuYiLu {

    public static int arrayPairSum(int[] nums) {
        int sum = 0;
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i += 2) {
            sum += nums[i];
        }
        return sum;
    }

    public static void main(String[] args) {
        int[] arr = {1,4,3,2,6,5};
        int i = arrayPairSum(arr);
        System.out.println(i);
    }

}
